package org.example.demos.pattern.strategy_pattern;

import java.util.HashMap;

public enum LoginTypeEnum {
    LOCAL("localLogin","200"),
    WECHAT("weChatLogin","201");

    private String name;
    private String code;



    public String getName() {
        return name;
    }

    LoginTypeEnum(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    private static HashMap<String, LoginTypeEnum> map = null;

    static {
        map = new HashMap<String, LoginTypeEnum>();
        LoginTypeEnum[] items = LoginTypeEnum.values();
        for (LoginTypeEnum item : items) {
            map.put(item.getName(), item);
        }
    }


    public static LoginTypeEnum find(String value) {
        if (value == null) {
            return null;
        }
        return map.get(value);
    }

}
